package cn.wzptsoft.tinymallbe.service;

import cn.wzptsoft.tinymallbe.entity.Theme;
import cn.wzptsoft.tinymallbe.repository.ThemeRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ThemeService {
    private final ThemeRepository themeRepository;

    public ThemeService(ThemeRepository themeRepository) {
        this.themeRepository = themeRepository;
    }

    /**
     * 获取一组专题
     *
     * @param names 专题名称
     * @return List<Theme>
     */
    public List<Theme> findByNames(List<String> names) {
        return themeRepository.findByNameIn(names);
    }

    /**
     * 获取某个专题的详情 含商品列表
     *
     * @param name 专题名称
     * @return Theme
     */
    public Theme findByName(String name) {
        return themeRepository.findByName(name);
    }
}
